import urllib.request

url = 'https://m.douban.com/rexxar/api/v2/subject/recent_hot/movie?start=40&limit=20'

header = {
    'Referer' : 'https://movie.douban.com/explore',
    'user-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36'
}

req = urllib.request.Request(url,headers=header)

resp = urllib.request.urlopen(req)
j = resp.read().decode('utf-8')

print(j)